import 'package:flustars_flutter3/flustars_flutter3.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ThemeProvider extends ChangeNotifier {
  Color _defaultColor = const Color(0xFFFFE3BB);

  Color get mainColor => getThemeData();

  void setDefaultColor(Color newColor) {
    _defaultColor = newColor;
    SpUtil.putString('themeColor', newColor.value.toString());
    notifyListeners();
  }

  Color getThemeData() {
    if (SpUtil.getString('themeColor') != null && SpUtil.getString('themeColor')!.isNotEmpty) {
      return Color(int.parse(SpUtil.getString('themeColor')!));
    } else {
      return _defaultColor;
    }
  }
}
